﻿#define _CRT_SECURE_NO_WARNINGS//购物
#include<stdio.h>
int main()
{
	float money = 0.0;
	int year;
	int day;
	int is;
	scanf("%f %d %d %d", &money, &year, &day, &is);
	if (year == 11 && day == 11)
	{
		money = money * 0.7;
		if (1 == is)
			money -= 50;
		if (money > 0)
			printf("%f", money);
		else
			printf("0");
	}
	if (year == 12 && day == 12)
	{
		money = money * 0.8;
		if (1 == is)
			money -= 50;
		if (money > 0)
			printf("%f", money);
		else
			printf("0");
	}
	return 0;
}